package org.chen.model.elastic;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

// 爬虫任务实体
@Data
@Document(collection = "crawler_tasks")
@AllArgsConstructor
@NoArgsConstructor
public class CrawlerTask {
    @Id
    private String id;
    private String name;            // 任务名称
    private String ruleDescription;            // 任务别名
    private String url;             // 目标网址
    private String ruleId;          // 规则ID
    private String status;          // 状态
    private Integer pageCount;      // 已爬取页数
    private Boolean autoPublish;    // 是否自动发布
    private Boolean crawlImages;    // 是否爬取图片
    private String errorMessage;    // 错误信息
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;         // 开始时间
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;           // 结束时间
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
}